package qq.android.wan.qq.chat;

import android.content.ContentValues;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * Created by 万 on 2016/3/3.
 */
public class MyDateBaseHelper extends SQLiteOpenHelper {
    public MyDateBaseHelper(Context context) {
        super(context, "QQ.db", null, 1);
    }


    @Override
    public void onCreate(SQLiteDatabase sqLiteDatabase) {
        sqLiteDatabase.execSQL("create table friends(qqId string,nick string)");
        sqLiteDatabase.execSQL("create table chatHistory(qqId string,nick string,lastMessage string,lastTime timestamp default (datetime(CURRENT_TIMESTAMP,'localtime')))");
        for (int i=1;i<200;i++){
            ContentValues values=new ContentValues();
            values.put("qqId",i);
            values.put("nick","我的QQ号是"+i);
            sqLiteDatabase.insert("friends",null,values);
        }
    }

    @Override
    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {

    }
}
